package com.hqyj.server.util;

import java.math.BigDecimal;

public class Demo {

    public static void main(String[] args) {

        double num1= 0.1;
        double num2 = 0.2;
        double num3 = 0.5;

        //0.5 0.25 0.125
        //
        System.out.println(num1 + num2); //0.3
        System.out.println(num3 - num2); //0.3

        BigDecimal bNum1 = new BigDecimal("0.1");
        BigDecimal bNum2 = new BigDecimal("0.2");

        BigDecimal bNum3 = new BigDecimal("0.5");
        System.out.println(bNum1.add(bNum2));
        System.out.println(bNum3.subtract(bNum2));

    }
}
